import logging
from os.path import dirname, abspath
from flask import Flask
from flask_admin import Admin
from flask_babelex import Babel
from flask_sqlalchemy import SQLAlchemy
from flask_admin.contrib.fileadmin import FileAdmin
from .settings import *

project_dir = dirname(abspath(__file__))

# Flask setup
application = Flask(__name__)
application.config.from_pyfile('settings.py')

db = SQLAlchemy(application)
babel = Babel(application)

# Add administrative views
admin = Admin(application, name=application.config.get("APP_NAME"), template_mode='bootstrap4')
from .views import *
# add views
admin.add_view(user_view)
admin.add_view(group_view)
admin.add_view(link_view)

# add api list
from .apis import *
